$wgOut->errorpage( "nosuchspecialpage", "nospecialpagetext" );
return;
}
-
+
if( !$wgUser->canSendEmail() ) {
wfDebug( "User can't send.\n" );
$wgOut->errorpage( "mailnologin", "mailnologintext" );
return;
}
-
+
$action = $wgRequest->getVal( 'action' );
$target = isset($par) ? $par : $wgRequest->getVal( 'target' );
if ( "" == $target ) {
$wgOut->errorpage( "notargettitle", "notargettext" );
return;
}
-
+
$nt = Title::newFromURL( $target );
if ( is_null( $nt ) ) {
wfDebug( "Target is invalid title.\n" );
$wgOut->errorpage( "notargettitle", "notargettext" );
return;
}
-
+
$nu = User::newFromName( $nt->getText() );
if( is_null( $nu ) || !$nu->canReceiveEmail() ) {
wfDebug( "Target is invalid user or can't receive.\n" );
$emm = wfMsg( "emailmessage" );
$ems = wfMsg( "emailsend" );
$encSubject = htmlspecialchars( $this->subject );
-
+
$titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
$action = $titleObj->escapeLocalURL( "target=" .
urlencode( $this->target->getName() ) . "&action=submit" );
function doSubmit() {
global $wgOut, $wgUser;
-
+
$to = new MailAddress( $this->target );
$from = new MailAddress( $wgUser );
$subject = $this->subject;
-
+
if( wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$this->text ) ) ) {
-
+
$mailResult = userMailer( $to, $from, $subject, $this->text );
-
+
if( WikiError::isError( $mailResult ) ) {
$wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
} else {